package com.xjtu.chapter03.ex3_1;

import java.sql.SQLOutput;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/8/10 10:54
 */
public class Samples {
    /*
添加两个方法，分别以传值和传引用方式实现。changValue(intlen)以整型为传递的参数;
changeName(Product ss)以类类型Product为传递的参数。
 */
    void changeValue(int len) {
        len += len;
        System.out.println("inside changeValuemethod, length value is: " + len);
    }

    void changeName(Product ss) {
        ss.name = " superIPad";
        System.out.println("inside changePrice method, Product name is: " + ss.name);
    }

    public static void main(String[] args) {
//        Product iphone = new Product();
//        int length = 20;
//        Product ipad = new Product(10, "ipad", "computer", 5000);
//        System.out.println("ipad price is: " + ipad.productPrice);
//        //测试参数传递
//        Samples obj = new Samples();
//        System.out.println("before change value, length is:" + length);
//        obj.changeValue(length);
//        System.out.println("after change value,length still is:" + length);
//        System. out . println( "before changing name , product name :"+ipad . name) ;
//        obj . changeName (ipad);
//        System. out .println("after changing name,product name has been changed to: "+ipad.name) ;
//        System.out.println(ipad);
//        //测试静态数据
//        System.out.println("Total price of products is : " + Product.totalPrice);
//        System.out.println("Total number of products is : " + Product.totalNumber);
        //测试this指针
        Product huawei = new Product();
        huawei.increment().increment().increment().print();
        Product xiaomi = new Product("xiaomi");
        System.out.println(xiaomi);
    }
}
